
from selenium import webdriver
from selenium.webdriver.common.by import By
from common.comvariable import driver_path_chrome

driver=webdriver.Chrome(executable_path=driver_path_chrome)

driver.get("https://trains.ctrip.com/trainBooking/search?ticketType=0&fromCn=%25E5%25B9%25B3%25E5%2587%2589&toCn=%25E5%25B9%25B3%25E5%2587%2589%25E5%258D%2597&day=2020-09-29&mkt_header=&orderSource=")

driver.find_element_by_css_selector("#selTicketType>[value='2']").click()

import time

time.sleep(6)
#使用js删除readonly属性

# element=driver.find_element_by_css_selector("#departDate")
# driver.execute_script('arguments[0].removeAttribute(\"readonly\")',element)
# element.clear()
# element.send_keys("2020-09-27")
#
# driver.find_element_by_css_selector('')

driver.execute_script('document.querySelector("#departDate").removeAttribute(\"readonly\")')
driver.find_element_by_css_selector("#departDate").clear()
driver.find_element_by_css_selector("#departDate").send_keys("2020-09-27")

